package ar.edu.utn.frba.disenio.aterrizar.ui.arena;

import org.uqbar.arena.actions.MessageSend;
import org.uqbar.arena.layout.HorizontalLayout;
import org.uqbar.arena.layout.VerticalLayout;
import org.uqbar.arena.widgets.Button;
import org.uqbar.arena.widgets.Label;
import org.uqbar.arena.widgets.Panel;
import org.uqbar.arena.windows.WindowOwner;

public class SobreReservaWindow extends AterrizarWindow<BuscadorAsientos>{

	private String mensaje;
	
	public SobreReservaWindow(WindowOwner owner, BuscadorAsientos model, String mensajeException) {
		super(owner, model);
		this.mensaje = mensajeException;
	}
	
	@Override
	public void createContents(Panel mainPanel) {
		super.createContents(mainPanel);
		mainPanel.setLayout(new VerticalLayout());
		new Label(mainPanel).setText(mensaje);
		
		Panel aPanel = new Panel(mainPanel);
		aPanel.setLayout(new HorizontalLayout());
		new Label(aPanel).setText("¿Que desea hacer?");
		this.createActionsPanel(mainPanel);
	}
	
	@Override
	public void createActionsPanel(Panel mainPanel){
		Panel aPanel = new Panel(mainPanel);
		aPanel.setLayout(new HorizontalLayout());
		
		Button comprar = new Button(aPanel);
		comprar.setCaption("Sobrereservar");
		comprar.onClick(new MessageSend(this, "sobreReservar"));
		
		new Button(aPanel)//
		.setCaption("Seguir Buscando")
		.onClick(new MessageSend(this, "close")); 
	}
	
	public void sobreReservar(){
		this.getModelObject().sobreReservar();
		this.close();
	}

}
